package com.right.health.app.ui.registered.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.magic.basic.adapter.BaseAbsAdapter;
import com.right.health.app.R;
import com.right.health.app.bean.FamilyResponse;

import java.util.List;

public class PatientAdapter extends BaseAbsAdapter<FamilyResponse.FamilyInfo> {

    public PatientAdapter(Context context, List<FamilyResponse.FamilyInfo> patients) {
        super(context);
        setDataSource(patients);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if(convertView == null) {
            viewHolder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.item_current_patient, null);
            viewHolder.nameTv = convertView.findViewById(R.id.tv_name);
            convertView.setTag(viewHolder);

        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.nameTv.setText(mDataSource.get(position).membername);
        return convertView;
    }

    private static class ViewHolder{
        private TextView nameTv;

    }
}
